<template>
  <div id="home">
    <el-header>
      <p class="header_p1">美业管理系统</p>
      <div class="header_div1">
        <el-dropdown trigger="click">
          <span class="el-dropdown-link">
            {{$store.state.routers.userInfo.username}}<i class="el-icon-caret-bottom el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item class="clearfix" @click.native="exitLogin">
              退出
              <el-badge class="mark" />
            </el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </el-header>
    <el-container>
      <el-aside width="250px">
        <MenuList></MenuList>
      </el-aside>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </div>
</template>

<script>
import { resetRouter } from '../router/index'
import MenuList from '@/components/MenuList.vue';
export default {
  name: 'Home',
  components: { MenuList },
  data () {
    return {
    };
  },
  methods: {
    exitLogin () {
      resetRouter(this.$router)
      window.sessionStorage.clear()
      this.$router.push('/login')
    },
  },
};
</script>

<style scoped lang="less">
@bgcolor: rgb(84, 92, 100);
@fontcolor: rgb(255, 255, 255);
#home {
  width: 100%;
  height: 100%;
}
.el-aside {
  background-color: @bgcolor;
  .el-menu {
    border: none;
    .iconfont {
      margin-right: 15px;
    }
  }
}
.el-header {
  width: 100%;
  height: 60px;
  background-color: @bgcolor;
  position: relative;
  .header_p1 {
    float: left;
    margin: auto;
    width: 200px;
    height: 60px;
    line-height: 60px;
    text-align: left;
    color: @fontcolor;
    font-size: 20px;
    span {
      margin-right: 20px;
      &:hover {
        cursor: pointer;
      }
    }
  }
  .header_div1 {
    width: 150px;
    height: 40px;
    position: absolute;
    top: 0;
    bottom: 0;
    right: 20px;
    margin: auto;
    img {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      vertical-align: middle;
      margin-right: 10px;
    }
    span {
      color: @fontcolor;
      position: relative;
      &:hover {
        cursor: pointer;
      }
    }
  }
}
.el-container {
  width: 100%;
  height: calc(100% - 60px);
}
</style>
